package tmi.li.txwidgets.txclck;


import tmi.li.txwidgets.TxWidgetsFinals;
import android.appwidget.AppWidgetManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class TxClckReceiver extends BroadcastReceiver{
	static String TAG = "tmi.li.txwidgets.txclck.TxClckReceiver";

	@Override
	public void onReceive(Context context, Intent intent) {
		//since we dont check what broadcast we received we skip that part
		//String action = intent.getAction();

		Log.d(TAG, "onReceive() intent => "+intent.getAction());

		//getting the app widget Manager instance
		AppWidgetManager gm = AppWidgetManager.getInstance(context);
		int[] appWidgetIds = gm.getAppWidgetIds(new ComponentName(context.getApplicationInfo().packageName, TxWidgetsFinals.TXCLCK_WIDGET_CLASS_PATH));
			for(int i = 0; i < appWidgetIds.length; i++) {
				//updating each widget
				TxClckProvider.updateWidget(context, gm, appWidgetIds[i]);
			}


	}
}